﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml;
using Sasa.QualityTools.CodeAnalysis.Common;

namespace Sasa.QualityTools.CodeAnalysis.FxCopIntegrator.ViewModels
{
    public class CodeInspectionResultGridViewModel : CodeAnalysisResultGridViewModelBase
    {
        protected override string SettingPath
        {
            get
            {
                return Path.Combine(Core.Constants.AppDataDir, "CodeInspectionResultDataGridColumnSetting.xml");
            }
        }

        protected override IEnumerable<DataGridColumnViewModel> DataGridColumnViewModels
        {
            get
            {
                yield return Kind;
                yield return CheckId;
                yield return Category;
                yield return Project;
                yield return File;
                yield return Message;
            }
        }


        public DataGridColumnViewModel Kind { get; private set; }

        public DataGridColumnViewModel CheckId { get; private set; }

        public DataGridColumnViewModel Category { get; private set; }

        public DataGridColumnViewModel Project { get; private set; }

        public DataGridColumnViewModel File { get; private set; }

        public DataGridColumnViewModel Message { get; private set; }


        public CodeInspectionResultGridViewModel()
        {
            Kind = new DataGridColumnViewModel("Kind");
            CheckId = new DataGridColumnViewModel("CheckId");
            Category = new DataGridColumnViewModel("Category");
            Project = new DataGridColumnViewModel("ProjectName");
            File = new DataGridColumnViewModel("FileName");
            Message = new DataGridColumnViewModel("Message");
            Reset();
        }


        public override void Reset()
        {
            Kind.DisplayIndex = 0;
            Kind.IsVisible = true;
            Kind.Width = 25;
            CheckId.DisplayIndex = 1;
            CheckId.IsVisible = true;
            CheckId.Width = 80;
            Category.DisplayIndex = 2;
            Category.IsVisible = true;
            Category.Width = 80;
            Project.DisplayIndex = 3;
            Project.IsVisible = true;
            Project.Width = 80;
            File.DisplayIndex = 4;
            File.IsVisible = true;
            File.Width = 80;
            Message.DisplayIndex = 5;
            Message.IsVisible = true;
            Message.Width = 350;
        }
    }
}
